﻿using MediatR;
using Reporting.API.DTOs.ProductionorderPlanDTO;
using Reporting.API.Utils;
using Reporting.Domain.Enum;
using Reporting.Errorcode;
using System.Xml.Linq;

namespace Reporting.API.Application.Commands.Productionorders
{

    /// <summary>
    /// 显示生产计划
    /// </summary>
    public class GetProductionorderCommand : IRequest<ApiResult<PagingResult<IList<ProductionorderPlanResponse>>>>
    {
        /// <summary>
        /// 任务编号、名称
        /// </summary>
        public string? TaskNumberName { get; set; }

        /// <summary>
        ///计划名称、 计划编号
        /// </summary>
        public string? PlanNameAndNumber { get; set; }

        /// <summary>
        /// 产品名称
        /// </summary>
        public string? Productname { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public StateEnum? Productionorderstate { get; set; }


        /// <summary>
        /// 当前页
        /// </summary>
        public int PageIndex { get; set; }

        /// <summary>
        /// 页容量
        /// </summary>
        public int PageSize { get; set; }
    }    
    


    /// <summary>
    /// 关联生产编号查询
    /// </summary>
    public class SelectProductionorderCommand : IRequest<ApiResult<SelectProductionorderResponse>>
    {
        /// <summary>
        /// 工单编号
        /// </summary>
        public string Workordernumber { get; set; }
    }


    /// <summary>
    /// 删除生产工单
    /// </summary>
    public class DelProductionCommand : IRequest<ApiResult>
    {
        /// <summary>
        /// 生产工单ID
        /// </summary>
        public int Productionorderid { get; set; }
    }



    /// <summary>
    /// 添加生产工单
    /// </summary>
    public class AddProductionorderCommand:IRequest<ApiResult>
    {
        /// <summary>
        /// 工单编号
        /// </summary>
        public string Workordernumber { get; set; }

        /// <summary>
        /// 工单名称
        /// </summary>
        public string Workordername { get; set; }

        /// <summary>
        /// 工单进度
        /// </summary>
        public int? Workorderprogress { get; set; }  // 0-100

        /// <summary>
        /// 关联计划
        /// 外健（生产计划）
        /// </summary>
        public int Productionplanid { get; set; }

        /// <summary>
        /// 产品名称
        /// </summary>
        public string Productname { get; set; }

        /// <summary>
        /// 产品编号
        /// </summary>
        public string Productnumber { get; set; }

        /// <summary>
        /// 规格型号
        /// </summary>
        public string Specificationandmodel { get; set; }

        /// <summary>
        /// 产品类型
        /// 外健（产品类型）
        /// </summary>
        public int? ProductTypeID { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        public string Productionorderunit { get; set; }

        /// <summary>
        /// 需求日期
        /// </summary>
        public DateTime? Requirementdate { get; set; }

        /// <summary>
        /// 计划数量
        /// </summary>
        public int Plannedproduction { get; set; }

        /// <summary>
        /// 实际生产数量
        /// </summary>
        public int Actualproductionquantity { get; set; }

        /// <summary>
        /// 计划开工时间
        /// </summary>
        public DateTime? Scheduledstarttime { get; set; }

        /// <summary>
        /// 计划完工时间
        /// </summary>
        public DateTime? Plannedendtime { get; set; }

        /// <summary>
        /// 实际开工时间
        /// </summary>
        public DateTime? Actualstarttime { get; set; }

        /// <summary>
        /// 实际完工时间
        /// </summary>
        public DateTime? Actualendtime { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public StateEnum Productionorderstate { get; set; }
    }


    /// <summary>
    /// 修改生产工单
    /// </summary>
    public class UpdateProductionorderCommand : IRequest<ApiResult>
    {
        /// <summary>
        /// 生产工单ID
        /// </summary>
        public int Productionorderid { get; set; }
        /// <summary>
        /// 工单编号
        /// </summary>
        public string Workordernumber { get; set; }

        /// <summary>
        /// 工单名称
        /// </summary>
        public string Workordername { get; set; }

        /// <summary>
        /// 工单进度
        /// </summary>
        public int Workorderprogress { get; set; }  // 0-100

        /// <summary>
        /// 关联计划
        /// 外健（生产计划）
        /// </summary>
        public int Productionplanid { get; set; }

        /// <summary>
        /// 产品名称
        /// </summary>
        public string Productname { get; set; }

        /// <summary>
        /// 产品编号
        /// </summary>
        public string Productnumber { get; set; }

        /// <summary>
        /// 规格型号
        /// </summary>
        public string Specificationandmodel { get; set; }

        /// <summary>
        /// 产品类型
        /// 外健（产品类型）
        /// </summary>
        public int ProductTypeID { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        public string Productionorderunit { get; set; }

        /// <summary>
        /// 需求日期
        /// </summary>
        public DateTime Requirementdate { get; set; }

        /// <summary>
        /// 计划数量
        /// </summary>
        public int Plannedproduction { get; set; }

        /// <summary>
        /// 实际生产数量
        /// </summary>
        public int Actualproductionquantity { get; set; }

        /// <summary>
        /// 计划开工时间
        /// </summary>
        public DateTime Scheduledstarttime { get; set; }

        /// <summary>
        /// 计划完工时间
        /// </summary>
        public DateTime Plannedendtime { get; set; }

        /// <summary>
        /// 实际开工时间
        /// </summary>
        public DateTime Actualstarttime { get; set; }

        /// <summary>
        /// 实际完工时间
        /// </summary>
        public DateTime Actualendtime { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public StateEnum Productionorderstate { get; set; }
    }


}
